package main

func countBalls(lowLimit int, highLimit int) int {
	count := make(map[int]int)
	var res int
	for i := lowLimit; i <= highLimit; i++ {
		sum := 0
		for x := i; x > 0; x /= 10 {
			sum += x % 10
		}
		count[sum]++
		res = max(res, count[sum])
	}
	return res
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
